<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-on:事件绑定</title>
    <script src="js/vue.js"></script>
</head>
<body>
<div id="app">
    <p>@事件名称 帮绑定相应的事件  v-on:可以简写为@</p>
    {{sum}}
    <p>{{sum>10 ? "大于十" : "小于十"}}</p>
    <input type="button" value="增加" @click="increment(1)">
    <input type="button" value="减少" @click="decrease(1)">
</div>

<script>
    new Vue({
        el:"#app",
        data:{
            sum:0
        },
        methods:{
            increment:function (num) {
                this.sum+=num;
            },
            decrease:function (num) {
                this.sum -= num;
            }
        }
    });
</script>
</body>
</html>